#!/bin/bash

if [ -d $1 ];
then
echo "it is a directroy!"

if [[ `ls $1` = "" ]];
then
echo "the directroy is empty!"

else
a="$1"
B=$(date +%m%s)
tar -czvf ${B}.tar.gz "$a" >> /home/fengjian/message.txt 
echo "the directroy is  not empty!"
echo "backup is successful!"

fi

else
echo "failed!"
fi
exit 0
